home *** CD-ROM | disk | FTP | other *** search
- Path: soap.news.pipex.net!pipex!usenet
- From: m.hendry@dial.pipex.com (Mathew Hendry)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Fastest datatype?
- Date: Wed, 13 Mar 96 10:15:54
- Organization: Private node.
- Distribution: world
- Message-ID: <19960313.4B9168.9AD8@ak145.du.pipex.com>
- References: <83.6643T702T1298@academy.bastad.se>
- NNTP-Posting-Host: ak145.du.pipex.com
- X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
-
- Sten Jansson (sten@academy.bastad.se) wrote:
- : I've heard that float is faster than integer. Is that true?
-
- No, floating point arithmetic is almost always slower than integer arithmetic,
- whether the floating point functions are implemented in hardware or emulated
- by integer instructions.
-
- If you mean "is emulated floating point faster than floating point implemented
- in hardware?" then the answer is "depends". Emulated floating point can be
- very fast indeed if you are prepared to sacrifice some precision and / or use
- large amounts of memory to store lookup tables. Whether you get a win from
- this or not depends on the relative speeds of the available integer and
- floating point hardware.
-
- As an example, many JPEG codecs around use emulated floating point arithmetic
- in their algorithms. Some precision is sacrificed in doing this, but the
- effects are generally not noticable. Run on a 68030 system, this works out
- faster than using a 68881 / 68882 to do the arithmetic (these FPUs are very
- slow by modern standards). On a 68040 or 68060, on the other hand, you lose
- by using integer, as the floating point units on these CPUs have been very
- heavily optimised. Horses for courses.
-
- -- Mat.
-
-